import { BrowserRouter as Router, Routes, Route } from "react-router-dom"
import App from "@/App"
// import Home from "@/views/Home/Home" //正常写法
import { lazy } from "react"//引入懒加载
//下面是懒加载写法
const Home = lazy(() => import("@/views/Home/Home"))
const User = lazy(() => import("@/views/User/User"))
const Login = lazy(() => import("@/views/Login/Login"))
const Reg = lazy(() => import("@/views/Reg/Reg"))
const Fast = lazy(() => import("@/views/Fast/Fast"))
const Subject = lazy(() => import("@/views/Subject/Subject"))
const Practice = lazy(() => import("@/views/Practice/Practice"))
const Test = lazy(() => import("@/views/Test/Test"))

const router = (
    <Router>
        <Routes>
            <Route path="/" element={<App />}>
                <Route path="/fast" element={<Fast />}></Route>
                <Route path="/user" element={<User />}></Route>
                <Route path="/home" element={<Home />}></Route>
                <Route path="/subject/:code" element={<Subject />}></Route>
                <Route path="/practice/:code" element={<Practice />}></Route>
                <Route path="/test" element={<Test />}></Route>
            </Route>
            <Route path="/login" element={<Login />}></Route>
            <Route path="/reg" element={<Reg />}></Route>
        </Routes>
    </Router>
)
export default router
